﻿using MediatR;
using Practice.Common.Domains;
using Practice.Common.Dto;
using Practice.Common.Infrastructure.Interfaces;

namespace Practice.API.Application.Commands.Roles
{
    public class RoleCheckHandler : IRequestHandler<RoleCheckCommand, Result>
    {
        public readonly IBaseRepository<Role> RoleRepository;

        public RoleCheckHandler(IBaseRepository<Role> roleRepository)
        {
            RoleRepository = roleRepository;
        }

        public async Task<Result> Handle(RoleCheckCommand request, CancellationToken cancellationToken)
        {
            var result = new Result();
            result.Data = RoleRepository.GetAll().ToList();
            return result;
        }
    }
}
